package site.zbox.tool.swing.xml;

import java.util.HashMap;
import java.util.Map;

import site.zbox.tool.lang.NumberUtils;
import site.zbox.tool.lang.StringUtils;
import site.zbox.tool.lang.Version;

@Version("2021.08.18")
public class AttributeValueMap {
    private final Map<String, String> map = new HashMap<>();

    public String put(final String key, final String value) {
        return map.put(key, value);
    }

    public boolean containsKey(final String key) {
        return map.containsKey(key);
    }

    public String getString(final String key) {
        return StringUtils.defaultString(map.get(key));
    }

    public int getInteger(final String key, final int defaultValue) {
        return NumberUtils.toInt(getString(key), defaultValue);
    }
}
